{{- /* FixIt theme environment detection */ -}}

{{- $params := partial "function/params.html" -}}

{{- if hugo.IsProduction -}}
  {{- $cdn := .Site.Params.cdn -}}
  {{- with $cdn.data -}}
    {{- $cdnData := printf "data/cdn/%v" . | resources.Get | transform.Unmarshal -}}
    {{- $cdn = dict "simpleIconsPrefix" $cdnData.prefix.simpleIcons -}}
    {{- $prefix := $cdnData.prefix.libFiles | default "" -}}
    {{- range $key, $value := $cdnData.libFiles -}}
      {{- $cdn = printf "%v%v" $prefix $value | dict $key | merge $cdn -}}
    {{- end -}}
  {{- end -}}
  {{- .Scratch.Set "cdn" $cdn -}}
  {{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
  {{- .Scratch.Set "analytics" .Site.Params.analytics -}}
  {{- .Scratch.Set "comment" $params.comment -}}
  {{- if eq .Params.comment true -}}
    {{- .Scratch.Set "comment" .Site.Params.page.comment -}}
  {{- else if eq .Params.comment false -}}
    {{- .Scratch.Set "comment" (dict "enable" false) -}}
  {{- end -}}
{{- else -}}
  {{- .Scratch.Set "devOpts" .Site.Params.dev -}}
  {{- if ne .Site.Params.dev.enable true -}}
    {{- .Scratch.Set "devOpts" dict -}}
  {{- end -}}
  {{- if eq .Site .Sites.First -}}
    {{- warnf "FixIt %v\n%v\n\n" (.Scratch.Get "version") (T "init.devEnvWarn") -}}
  {{- end -}}
{{- end -}}
